{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/uncommon-words-from-two-sentences\n",
    "\n",
    "\n",
    "Runtime: 0 ms, faster than 100.00% of Go online submissions for Uncommon Words from Two Sentences.\n",
    "Memory Usage: 2.2 MB, less than 34.48% of Go online submissions for Uncommon Words from Two Sentences.\n",
    "\n",
    "\n",
    "```go\n",
    "package main\n",
    "\n",
    "import (\n",
    "\t\"strings\"\n",
    ")\n",
    "\n",
    "func updateCounter(counter map[string]int, l []string) {\n",
    "\tfor _, v := range l {\n",
    "\t\t_, exists := counter[v]\n",
    "\t\tif exists {\n",
    "\t\t\tcounter[v] += 1\n",
    "\t\t} else {\n",
    "\t\t\tcounter[v] = 1\n",
    "\t\t}\n",
    "\t}\n",
    "}\n",
    "\n",
    "func uncommonFromSentences(A string, B string) []string {\n",
    "\ta := strings.Split(A, \" \")\n",
    "\tb := strings.Split(B, \" \")\n",
    "\tcounter := make(map[string]int)\n",
    "\tr := make([]string, 0)\n",
    "\tupdateCounter(counter, a)\n",
    "\tupdateCounter(counter, b)\n",
    "\tfor k, v := range counter {\n",
    "\t\tif v == 1 {\n",
    "\t\t\tr = append(r, k)\n",
    "\t\t}\n",
    "\t}\n",
    "\treturn r\n",
    "}\n",
    "```\n",
    "\n",
    "\n",
    "> Weird, golang doesn't have a concept called `pass a variable by reference`, but indeed, the hashmap is passed as a reference variable."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go",
   "language": "go",
   "name": "gophernotes"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.15.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
